package com.jianhong.li.extend;

import com.jianhong.li.test.ObjectDiffTest.Bar;
import de.danielbechler.diff.identity.IdentityStrategy;

/**
 * @author jianhong.li Date: 2019-10-16 Time: 3:01 PM
 * @version $Id$
 */
public class SelfIdentityStratorgy implements IdentityStrategy {

    /**
     * TODO Contract: {@linkplain IdentityStrategy#equals(Object working, Object base)} must always be <code>true</code>
     * when <code>working == base</code>
     */
    public boolean equals(Object working, Object base) {
        if (working instanceof Bar && base instanceof Bar) {
            System.out.println("自定义相等比较*****************,working:"+working+",base: "+base);
            return ((Bar) working).getCity().equals(((Bar) base).getCity());
        }
        return false;
    }
}
